package com.zyc.trs;

import java.io.IOException;

import org.apache.poi.hssf.extractor.ExcelExtractor;

import com.zyc.util.ConfigPropertiesUtil;

public class IcpInfoMain {

	public IcpInfoMain() {
	}
	//public static final int startRowIndex = 100;
	public static void main(String[] args) {
		/*java.util.logging.Logger.getLogger("org.apache.http.wire").setLevel(java.util.logging.Level.FINEST);
		java.util.logging.Logger.getLogger("org.apache.http.headers").setLevel(java.util.logging.Level.FINEST);
		System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
		System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
		System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "ERROR");
		System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "ERROR");
		System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "ERROR");*/
		int startRowIndex =Integer.valueOf(ConfigPropertiesUtil.getProperties("beginIndex")) - 1 ;
		IcpInfoService iiService = new IcpInfoService();
		try {
			ExportToExcel exportToExcel = new ExportToExcel(ConfigPropertiesUtil.getProperties("sourceFile"));
			while(true) {
				IcpInfoBean icpInfoBean = new IcpInfoBean();
				icpInfoBean.setRowIndex(startRowIndex);
				String domain = exportToExcel.getCellValue(startRowIndex++, 3);
				icpInfoBean.setDomain(domain);
				//查询总页面 输入网站名 验证码 有是否正确的校验
				String icpId = iiService.searchIcpIdBySitedomain(icpInfoBean.getDomain());
				icpInfoBean.setIcpId(icpId);	
				
				//根据获取到的IcpId 取得详细信息
				icpInfoBean = iiService.getDetailInfoByIcpId(icpInfoBean);
				exportToExcel.setIcpInfoInText(icpInfoBean);
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
